<?php

class Users_Model_Comments {

    private $_dbtable;

    public function __construct() {
        $this->_dbtable = new Users_Model_DbTable_Comments();
    }

    public function fetchAll() {
        $select = $this->_dbtable->select();
        return $this->_dbtable->fetchAll($select);
    }

    public function addNewComment($data) {
        $this->_dbtable->insert($data);
    }

    public function updateComment($data, $id) {
        $this->_dbtable->update($data, " id = $id");
    }

    public function getAllCommentByUser($id) {
        $select = $this->_dbtable->select();
        $select->where("user_id = ? ", $id);
        return $this->_dbtable->fetchAll($select);
    }

}

